nLab dependent type

Redirected from "type family".
Contents

Context

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Contents

Idea

In type theory, a dependent type or type in context is a family or bundle of types which vary over the elements (terms) of some other type. It can be regarded as a formalization of the notion of “indexed family,” providing a structural account of families (in contrast to the material approach which requires sets to be able to contain other sets as elements).

Type theory with the notion of dependent types is called dependent type theory.

In the categorical semantics of type theory, a dependent type

x:AB(x):type x:A \; \vdash \;B(x): \;\mathrm{type}

is represented by a particular morphism p:BAp\colon B\to A, the intended meaning being that each type B(x)B(x) is the fiber of pp over xAx\in A. The morphism in a category that may represent dependent types in this way are sometimes called display morphisms (especially when not every morphism is a display morphism).

Dependent types can be thought of as fibrations (Serre fibrations) in classical homotopy theory. The base space is XX, the total space is (x:X)P(x)\sum_{(x:X)}P(x) and the fiber P( X)P(\star_X). This gives the fibration:

P( X) x:XP(x)XP(\star_X)\to \sum_{x:X}P(x) \to X

Relation to families of elements.

One may understand AA-dependent types a:AB(a)a \colon A \;\vdash\; B(a) equivalently as functions BAB \to A with codomain AA, i.e. as “type-bundles” (in the general, not in locally trivial sense of fiber bundles, though) or “type-fibrations” (in a rather accurate sense):

The domain BB — i.e. the “total space” of these bundles — is identified with the dependent sum of the “fibersB(a)B(a), and conversely these fibers are indeed recovered from any such bundle as the fiber types.

Under the categorical semantics of dependent type theory (cf. categorical model of dependent types and relation between type theory and category theory) it is exactly these associated “type bundles” which are identified with actual fibrations (“display maps”) in the given semantic category.

We now say this in more detail, first

and then as

Syntactically

Given a family of types, x:AB(x)x:A \vdash B(x), one can construct a family of elements z: x:AB(x)π 1(z):Az:\sum_{x:A} B(x) \vdash \pi_1(z):A via the elimination rules for negative dependent sum types:

ΓAtypeΓ,x:AB(x)typeΓ,z: x:AB(x)π 1(z):A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, z:\sum_{x:A} B(x) \vdash \pi_1(z):A}

Conversely, given a family of elements x:Af(x):Bx:A \vdash f(x):B one can construct a family of types y:B x:Af(x)= Byy:B \vdash \sum_{x:A} f(x) =_B y as the family of fiber types of x:Af(x):Bx:A \vdash f(x):B, via the formation rules for identity types and dependent sum types:

ΓAtypeΓAtypeΓBtypeΓ,x:Af(x):BΓ,x:A,y:Bf(x)= BytypeΓ,y:B x:Af(x)= Bytype\frac{\Gamma \vdash A \; \mathrm{type} \quad \frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B}{\Gamma, x:A, y:B \vdash f(x) =_B y \; \mathrm{type}}}{\Gamma, y:B \vdash \sum_{x:A} f(x) =_B y \; \mathrm{type}}

This corresponds to the relation between type theory and category theory: there are two ways to interpret a morphism f:Hom C(A,B)f:\mathrm{Hom}_C(A, B) in a category CC

  • as a family of elements x:Af(x):Bx:A \vdash f(x):B
  • as a family of types y:BA(y)y:B \vdash A(y)

If the type theory has function types, then the above notions are also interderivable with an element of a function type f:ABf:A \to B, which correspond to the internal hom of a category CC.

One can additionally derive the following equivalences of types:

p:A y:B x:A(f(x)= By) p \;\;\;\; \colon \;\;\;\; A \;\; \simeq \; \sum_{y:B} \sum_{x:A} \big( f(x) =_B y \big)
y:Bq(y):A(y) z: x:BA(x)(π 1(z)= Ay) y \colon B \;\;\;\; \vdash \;\;\;\; q(y) \;\;\; \colon \;\;\; A(y) \;\simeq\; \sum_{ \mathclap{ z \colon \sum_{x:B} A(x) } } \big( \pi_1(z) =_A y \big)

Reflected in the type universe

Assuming the univalence-axiom, the analogous statement holds reflected within a type universe TypeType: Given X:TypeX \,\colon\, Type, the type XTypeX \to Type of XX-dependent types is equivalent to the type (X:Type)×(YX)(X \colon Type) \times (Y \to X) of functions with codomain XX, via forming fiber types and dependent sum-types, respectively [UFP13, Thm. 4.8.3]

X:Type(Y:Type)×(YX)(XType). X \colon Type \;\;\;\; \vdash \;\;\;\; (Y \colon Type) \times (Y \to X) \;\; \simeq \;\; \big( X \to Type \big) \,.

Under the categorical semantics of homotopy type theory in \infty -toposes, this characterizes the type universe as (interpreted by) the (small) object classifier in an \infty -topos.

Examples

When the theory of a category is phrased in dependent type theory then there is one type “objobj” of objects and a type homhom of morphisms, which is dependent on two terms of type objobj, so that for any x,y:objx,y:obj there is a type hom(x,y)hom(x,y) of arrows from xx to yy. This dependency is usually written as x,y:objhom(x,y):Typex,y:obj \vdash hom(x,y):Type. In some theories, it makes sense to say that the type of “homhom” itself is obj,objTypeobj, obj\to Type (usually understood as obj(objType)obj \to (obj \to Type) or (obj×obj)Type(\obj \times \obj) \to Type), i.e. a function from pairs of elements of AA to the universe TypeType of types.

References

See the references at dependent type theory.

Exposition:

In Coq:

  • Yves Bertot?, Introduction to dependent types in Coq [pdf]

The relation between dependent types and bundles (functions of given codomain)

Last revised on January 22, 2024 at 05:47:12. See the history of this page for a list of all contributions to it.